<?php

namespace app\Http\Controllers\admin_system;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use DB;
use Illuminate\Support\Facades\Auth;


class indexController extends Controller
{

    public function __construct()
    {
        $this->middleware('checkcookies');
    }


    public function index_get(Request $request)
    {
        $data['title']       = '网站后台管理中心';
        $data['keywords']    = '网站后台管理中心';
        $data['description'] = '网站后台管理中心';
        $userId              = $request->session()->get('userId');
        $userInfo            = DB::table('manageuser')->where('UserId', $userId)->first();
        $data['manage']      = $userInfo;

        $mainTitle = DB::table('system_menu')->where('menu_type',1)->get();
        foreach($mainTitle as $title){
            $title->subTitle = DB::table('system_menu')
                ->where('parent_id',$title->menu_id)
                ->where('is_delete',0)
                ->get();
        }
        $data['menus'] = $mainTitle;

        return view('admin_system/index/index', $data);
    }

    public function welcome()
    {
        return view('admin_system/index/welcome');
    }
}